import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    infoDialog: {
      title: '',
      active: false,
      width: '',
      beforeClose: null,
      component: ''
    },
    warningDialog: {
      title: '',
      active: false,
      width: '',
      beforeClose: null,
      component: ''
    },
    errorDialog: {
      title: '',
      active: false,
      width: '',
      beforeClose: null,
      component: ''
    }
  },
  mutations: {
    setDialogConfig: (state, dialogConfig) => {
      state[dialogConfig.type] = dialogConfig
    },
    closeAllDialog: (state) => {
      state.infoDialog.active = state.warningDialog.active = state.errorDialog.active = false
    }
  },
  actions: {

  }
})
